//
//  PreDetailViewController.m
//  艾听歌
//
//  Created by dllo on 16/5/22.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "PreDetailViewController.h"

@interface PreDetailViewController ()
@property (nonatomic, strong) UIWebView *web;

@end

@implementation PreDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
//    self.view.backgroundColor = [UIColor whiteColor];
    self.view.dk_backgroundColorPicker = DKColorPickerWithRGB(0xffffff, 0x9c9c9c);
    self.navigationController.navigationBar.dk_barTintColorPicker = DKColorPickerWithRGB(0xFF6EB4, 0x9C9C9C);
    NSString *str = _string;
    UIWebView *wv = [[UIWebView alloc] initWithFrame:self.view.frame];
    
    [self.view addSubview:wv];
    
    //加载数据
    NSURL *url = [NSURL URLWithString:str];
    NSURLRequest *req = [NSURLRequest requestWithURL:url];
    [wv loadRequest:req];
    

    
    
    
//    self.web = [[UIWebView alloc] initWithFrame:self.view.frame];
//    [self.view addSubview:self.web];
//   
//    
//    
//    
//    NSString *str = [[NSString alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:_string]] encoding:NSUTF8StringEncoding];
//    [self.web loadHTMLString:str baseURL:nil];
//
//    
}
//- (void)webViewDidFinishLoad:(UIWebView *)webView{
//    
//    //拦截网页图片  并修改图片大小
//    [webView stringByEvaluatingJavaScriptFromString:
//     @"var script = document.createElement('script');"
//     "script.type = 'text/javascript';"
//     "script.text = \"function ResizeImages() { "
//     "var myimg,oldwidth;"
//     "var maxwidth= 375;" //缩放系数,调动这个参数可以改变图片的宽度
//     "for(i=0;i <document.images.length;i++){"
//     "myimg = document.images[i];"
//     "oldwidth = myimg.width;"
//     "myimg.width = maxwidth;"
//     "myimg.height = myimg.height;"
//     "}"
//     "}\";"
//     "document.getElementsByTagName('head')[0].appendChild(script);"];
//    
//    [webView stringByEvaluatingJavaScriptFromString:@"ResizeImages();"];
//}
//
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
